#include "lines.h"
#include <QApplication>
#include <QPainter>
#include <math.h>

Lines::Lines(QWidget *parent)
    : QWidget(parent)
{

}

int intoarcePixelX(float k)
{
int aux=20;
for(float i=-10;i<=10 && i<=k;i+=0.035)
{
aux++;
}

return aux;
}

int intoarcePixelY(float k)
{
int aux=620;
for(float i=-10;i<=10 && i<=k;i+=0.035)
{
aux--;
}

return aux;
}



void Lines::paintEvent(QPaintEvent *event)
{

  QPen pen(Qt::black, 2, Qt::SolidLine);

  QPainter painter(this);

  painter.setPen(pen);
  painter.drawLine(20, 320, 620, 320);
  painter.drawLine(320, 20, 320, 620);
  QPen pen1(Qt::red, 2, Qt::SolidLine);
  painter.setPen(pen1);
  float k=-10;
  int x=20;
  while(k<=10)
  {
    painter.drawPoint(intoarcePixelX(k),intoarcePixelY(k+2));
    k=k+0.035;
  }
  
}
